package com.mjp.learn.annotation.demo01;

import java.lang.reflect.Field;

public class FieldTest {

    @MyField(description = "test", length = 12)
    private String username;


    public static void main(String[] args) {
        Class t = FieldTest.class;
        for (Field field : t.getDeclaredFields()) {
            MyField myFieldAnnotation = field.getAnnotation(MyField.class);
            System.out.println("字段:" + field.getName() + " 描述:" + myFieldAnnotation.description() + ",长度:" + myFieldAnnotation.length());
            System.out.println(field);
        }
    }
}
